how to write quadratic forms in matrix notation